//
//  LGTLookPriceAlert.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/30.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit

class LGTLookPriceAlert: LGTBaseVC {

    var titleLabel:UILabel?
    var topTimeLabel:UILabel?
    var workPriceLabel:UILabel?
    var workCountLabel:UILabel?
    var workTimeLabel:UILabel?
    var reviewTimeLabel:UILabel?
    var workTimesLabel:UILabel?
    var offlieLabel:UILabel?
    var payMoney:UILabel?
    var taskInfo:Dictionary<String, Any>?
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    
    override func setUI() {
        super.setUI()
        
        super.setUI()
        self.view.backgroundColor = BlackAlphaColor
        
        let backView:UIImageView = LGTViewCreateUtil.share.createImageViewCorner(corner: SizeFitFloat(10))
        backView.isUserInteractionEnabled = true
        backView.backgroundColor = UIColor.white
        self.view.addSubview(backView)
        backView.snp.makeConstraints { (make) in
            make.center.equalTo(self.view)
            make.width.equalTo(SizeFitFloat(303))
            make.height.equalTo(SizeFitFloat(401))
        }
        
        self.titleLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.center, textColor: TextColor, fontSize: SizeFitFloat(0), text: "查看单价")
        self.titleLabel?.font = Font_Bold_18
        backView.addSubview(self.titleLabel!)
        self.titleLabel?.snp.makeConstraints({ (make) in
            make.height.equalTo(SizeFitFloat(19))
            make.top.equalTo(SizeFitFloat(22))
            make.centerX.equalTo(backView)
        })
        
        let closeBtn:LGTButton = LGTViewCreateUtil.share.createLGTButton(image: "close_icon", selected: "close_icon", dW: SizeFitFloat(10), dH: SizeFitFloat(10))
        backView.addSubview(closeBtn)
        closeBtn.tag = 2
        closeBtn.snp.makeConstraints { (make) in
            make.width.height.equalTo(SizeFitFloat(13))
            make.right.equalTo(-SizeFitFloat(23))
            make.top.equalTo(SizeFitFloat(20))
        }
        
        
        let titleArray:Array<String> = ["任务单价：", "任务数量：", "做单时间：", "审核时间：", "做单次数：", "置顶天数：", "下线时间：", "支付金额："]
        self.workPriceLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.workCountLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.topTimeLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.workTimeLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.reviewTimeLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.workTimesLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.offlieLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.payMoney = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: YellowColor, fontSize: SizeFitFloat(15))
        let labelArray:Array<UILabel> = [self.workPriceLabel!, self.workCountLabel!,self.workTimesLabel!, self.workTimeLabel!, self.reviewTimeLabel!, self.topTimeLabel!, self.offlieLabel!, self.payMoney!]
        
        let topY:CGFloat = SizeFitFloat(68)
        let x0:CGFloat = SizeFitFloat(27)
        let h:CGFloat = SizeFitFloat(15)
        let itemH:CGFloat = SizeFitFloat(32)
        
        //任务
        for i in 0..<titleArray.count{
            let title:String = titleArray[i]
            let descLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: GrayColor, fontSize: h, text: title)
            backView.addSubview(descLabel)
            descLabel.snp.makeConstraints { (make) in
                make.left.equalTo(x0)
                make.top.equalTo(topY + itemH * CGFloat(i))
                make.height.equalTo(h)
            }
            
            let label:UILabel = labelArray[i]
            backView.addSubview(label)
            label.snp.makeConstraints { (make) in
                make.left.equalTo(descLabel.snp_rightMargin).offset(SizeFit(15))
                make.centerY.equalTo(descLabel)
                make.height.equalTo(h)
            }
        }
        
        let button:UIButton = LGTViewCreateUtil.share.createTextLGTButton(title: "我知道了", font: Font_Normal_15, color: UIColor.white, selectedColor:UIColor.white, corner: SizeFitFloat(20), backColor: YellowColor)
        backView.addSubview(button)
        button.snp.makeConstraints { (make) in
            make.bottom.equalTo(-SizeFitFloat(32))
            make.height.equalTo(SizeFitFloat(40))
            make.width.equalTo(SizeFitFloat(252))
            make.centerX.equalTo(backView)
        }
        
        button.addTarget(self, action: #selector(closeAction), for: UIControl.Event.touchUpInside)
        closeBtn.addTarget(self, action: #selector(closeAction), for: UIControl.Event.touchUpInside)
        
        
//        self.infoData = [
//            "workTime":workTime,
//            "offline":offline,
//            "workTimes":workTimes,
//            "reviewTime":reviewTime,
//            "topTimeStr": topTimeStr,
//            "payMoney":payStr,
//            "taskCountStr": taskCountStr]
        
        //任务
        self.workCountLabel?.text = self.taskInfo?["taskCountStr"] as? String
        self.workPriceLabel?.text = self.taskInfo?["workPrice"] as? String
        self.payMoney?.text = self.taskInfo?["payMoney"] as? String
        self.offlieLabel?.text = self.taskInfo?["offline"] as? String
        self.topTimeLabel?.text = self.taskInfo?["topTimeStr"] as? String
        self.workTimeLabel?.text = self.taskInfo?["workTime"] as? String
        self.workTimesLabel?.text = self.taskInfo?["workTimes"] as? String
        self.reviewTimeLabel?.text = self.taskInfo?["reviewTime"] as? String
    }
    
    @objc func closeAction(){
        
        self.dismiss(animated: false, completion: nil)
        
    }
}
